package com.community.contents.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.community.contents.dto.PostDTO;
import com.community.contents.entity.PostEntity;
import com.community.contents.entity.UserEntity;
import com.community.contents.mapper.PostMapper;
import com.community.contents.service.IPostService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.community.contents.vo.PostVo;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 帖子 服务实现类
 * </p>
 *
 * @author admin
 * @since 2023-02-22
 */
@Service
public class PostServiceImpl extends ServiceImpl<PostMapper, PostEntity> implements IPostService {

    @Override
    public void pageDto(Page<PostDTO> params) {
        baseMapper.pageDto(params);
    }

    @Override
    public PostVo detail(Integer id) {
        return baseMapper.detail(id);
    }


    @Override
    public void releaseList(Page<PostVo> p, Integer userId) {
        baseMapper.releaseList(p,userId);
    }


    @Override
    public Page<UserEntity> userList(Integer topicId,Page<UserEntity> page) {
        return baseMapper.userListPage(topicId,page);
    }

    @Override
    public void postList(Page<PostVo> page, Integer topicId) {
        baseMapper.postListPage(page,topicId);
    }

 @Override
    public List<PostEntity> hotPost() {
        List<PostEntity> postEntities = baseMapper.hotPost();
        return postEntities;
    }
}

